package cn.musi;

import cn.musi.kafka.ConsumerGroup;
import cn.musi.util.SpringBeanFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.system.ApplicationPidFileWriter;
import org.springframework.context.annotation.ComponentScan;
import tk.mybatis.mapper.autoconfigure.MapperAutoConfiguration;

@SpringBootApplication
@EnableAutoConfiguration(exclude = {MapperAutoConfiguration.class})
@MapperScan(basePackages = "cn.musi.dao")
@ComponentScan("cn.musi")
public class Application {
    private static Logger LOGGER = LoggerFactory.getLogger(Application.class);
    public static void main(String[] args) {
        new SpringApplicationBuilder(Application.class).
                listeners(new ApplicationPidFileWriter())
                .web(false)
                .run(args);

        ConsumerGroup consumerGroup = SpringBeanFactory.getBean(ConsumerGroup.class);
        consumerGroup.execute();
        LOGGER.info("启动成功");
    }
}
